# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=libatasmart
pkgver=0.19
pkgrel=6
pkgdesc='ATA S.M.A.R.T. reader and parser library'
arch=('loong64' 'x86_64')
url='https://0pointer.de/blog/projects/being-smart.html'
license=('LGPL')
depends=('glibc' 'systemd-libs')
source=("https://0pointer.de/public/$pkgname-$pkgver.tar.xz"
        '0001-Dont-test-undefined-bits.patch'
        '0002-Drop-our-own-many-bad-sectors-heuristic.patch')
sha256sums=('61f0ea345f63d28ab2ff0dc352c22271661b66bf09642db3a4049ac9dbdb0f8d'
            'ab19d6985bb524774607280a2ee62c48de01785660ff5206d80f778b6404188c'
            '9bb5ca3431f76c182c5b076e2db9378d696608c2ff1d53d01e55c530ba293ce1')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../0001-Dont-test-undefined-bits.patch
  patch -Np1 -i ../0002-Drop-our-own-many-bad-sectors-heuristic.patch
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --sbindir=/usr/bin
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
